﻿{include file="/public/header" /}
<div class="content-wraper full">
    <div class="tabs-link-wrap" level="first">
        <div class="tabs-link-scroll">
            <a class="active">全部订单</a>
        </div>
    </div>
    <div class="tools-bar">
        <a data-key="info"><i class="fa fa-book-reader"></i> 详情</a>
    </div>
    <div class="normal-line"></div>
    <div class="search_wraper" style="min-height: 51px;">
        <form class="normal_form search_form" onsubmit="return false;">
            <div class="condition" onscroll="Core.scrolling(this)">
            </div>
            <div class="row form-footer-bar">
                <button class="btn" type="reset" role="btn-cancel">重置</button>
                <button r-button class="btn btn-primary search-btn" type="submit" role="btn-submit">搜索</button>
                <button r-button style="display: none;" class="btn switch_search filter">展开搜索条件<i class="fa fa-angle-down"></i></button>
                <div style="margin: 10px 0 -10px;"><a class="search_close"><i class="fa fa-angle-up"></i>收起</a></div>
            </div>
        </form>
    </div>

    <div class="table_box">
        <table class="table_main" id="datalist"></table>
    </div>
</div>
<script type="text/javascript">
let Skeys = ['-','下单委托','','拒绝接单','待取货','已取货','已处理'];
Core.Easyui.FieldColumn = [
    {field:'txfrname',title:'接单人',width:120,align:'center'},
    {field:'distypename',title:'来源类型',width:80,align:'center'},
    {field:'title',title:'联系人',width:220,align:'left'},
    {field:'phone',title:'联系号码',width:130,align:'center'},    
    {field:'region',title:'城市区域',width:180,align:'left'},
    {field:'address',title:'详细地址',width:220,align:'left'},
    {field:'pettypename',title:'动物类型',width:80,align:'center'},
    {field:'weight',title:'预计重量(kg)',width:100,align:'center',formatter:function(value,row,index){
		return value || '';
	}},
    {field:'petnum',title:'数量',width:80,align:'center'},
    {field:'amount',title:'服务金额(元)',width:100,align:'center'},
    {field:'agreetime',title:'预约上门时间',width:100,align:'center'},
    {field:'remark',title:'备注',width:320,align:'left'},
    {field:'paytype',title:'支付类型',width:100,align:'center',formatter:function(value,row,index){
		return ['-','线下支付','微信','支付宝'][value] || '';
	}},
    {field:'paystate',title:'支付状态',width:100,align:'center',formatter:function(value,row,index){
		return ['-','待支付','无需支付','支付成功','支付失败'][value] || '';
	}},
	{field:'dateline',title:'下单时间',width:150,align:'center'},
];
Core.Easyui.FrozenColumn = [
{field:'ck',checkbox:true,width:30},
	{field:'orderid',title:'订单号',width:250,align:'left', search: true, nowsearch: true, searchtype: 'input'},
	{field:'status',title:'订单状态',width:80,align:'center',formatter:function(value,row,index){
		return Skeys[value] || '';
	}},
];
Core.Easyui.init($("#datalist"), {
    url: "{$_G['_mc_'] ?? ''}/ajax",
    idField: "id",
    fitColumns: false,
    singleSelect : true,
    columns: [Core.Easyui.FieldColumn],
    frozenColumns: [Core.Easyui.FrozenColumn],
    pageSize: 50,
    onDblClickRow: function (index,row){
        Core.Sys.Action('pop',row);
    },
},$(".search_form"));

Core.Sys.Action = function(Tkey,row){
    switch(Tkey){
        case 'info':
            var row = $('#datalist').datagrid('getSelected');
            if (!row || !row.id) {
                Core.Dialog.msg('请选择查看的数据');return;
            }
            Core.Sys.Action('pop',row);
        break;
        case 'pop':
            if (!row || !row.id) return;
            let link = "{$_G['_mc_'] ?? ''}/info/id/"+row.id;
            Core.Dialog.open({'father': 'top','framer': 'true','title': '订单详情: '+row.orderid,'width': '1024px','height': '720px','url': link});
        break;
    }
}
/**搜索 */
var Table_Filters = Core.Search.searchArray();
var filterType = Core.Search.typeList();
//var rsourceUrl = "/index/ajax/index"; //搜索字段基础数据
//var regionUrl = "/index/ajax/district/level/"; //城市搜索字段
Core.Search.initFilter(null,null);

$(document).ready(function(){
    $('.tools-bar').find('a[data-key]').on('click',function(){
        var Tkey = $(this).attr('data-key');
        if (!Core.rule('key',Tkey)) return false;
        Core.Sys.Action(Tkey);
    });
});
</script>
{include file="/public/footer" /}